<%--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

        <title>职位管理</title>

        <link href="../../css/mine.css" type="text/css" rel="stylesheet" />
        <script type="text/javascript" src="/js/jquery-1.8.3.min.js"></script>
        <script type="text/javascript">
                function  todeleteByRoleids() {
                 document.getElementById("mymethod").value="delete";
                 document.forms[1].submit();
                }

        /*    $(function () {
                $("#deleteByRoleids").click(function () {
                   var values = [];
                   $("[name='roleids']:checkbox").each(function(index,e){
                       if($(e).is(":checked")){
                           values.push($(e).val())
                       }
                   });
                   $.ajax({
                       url:"/resource/demo3/deleteByRoleidsA",
                       data:"ids="+JSON.stringify(values),
                       type:"post",
                       dataType:"json",
                       success:function () {

                       }
                   });
                });
            });*/
        </script>
    </head>
    <body>
        <style>
            .tr_color{background-color: #9F88FF}
        </style>
        <div class="div_head">
            <span>
                <span style="float: left;">当前位置是：系统管理-》职位设置</span>
                <span style="float: right; margin-right: 8px; font-weight: bold;">
                    <a style="text-decoration: none;" href="/resource/demo3/getDeptAndMenu">【添加】</a>
<%--					<a style="text-decoration: none;" href="/resource/demo3/deleteByRoleids">【删除】</a>--%>
                    <span onclick="todeleteByRoleids()" style="color: blue; cursor: pointer">【删除】</span>
                </span>
            </span>
        </div>
        <div></div>
        <div class="div_search">
            <span>
                <form action="/resource/demo3/findAllRoles" method="post">
                    职位名称: 
					<input type="text"  name="rname" value="${rname}" />
					 所属部门: 
					<input type="text" name="deptname" value="${deptname}"  />
					是否启用: 
					<select name="state" >
						<option value="-1"${state==-1 ?"selected":""} >---请选择---</option>
						<option  value="1" ${state==1 ?"selected":""}>是</option>
						<option value="0"  ${state== 0 ?"selected":""}>否</option>
					</select>
                    <input value="查询" type="submit" />

                </form>
            </span>
        </div>
            <div style="font-size: 13px; margin: 10px 5px;">
        <form action="/resource/demo3/deleteByRoleids" method="post">
            <input type="hidden" name="method" id="mymethod"/>
            <table class="table_a" border="1" width="100%">
                <tbody><tr style="font-weight: bold;">
                        <td width="40px;">序号</td>
                        <td width="30px;"><input type="checkbox"  name="roleids"/></td>
                        <td width="80px;"> 职位编码</td>
                        <td >职位名称</td>
						<td width="100px;">职位分类</td>
                        <td width="120px;">所属部门</td>                       
						<td width="120px;">状态</td>  
                        <td align="center" width="100px;">操作</td>
                    </tr>
                <c:forEach var="role" items="${pageInfo.list}" varStatus="num">
                    <tr id="product1">
                        <td>${num.count}</td>
                        <td><input type="checkbox" name="roleids" value="${role.roleid}"   ${role.state==0?"disabled":""} /></td>
						<td>${role.rolenum}</td>
                        <td><a href="view.jsp">${role.rname}</a></td>
						<td>管理</td> 						
                        <td>${role.dept.deptname}</td>
						<td>${role.state==0?"禁用":"启用"}</td>
                        <c:if test="${role.state==1}">
                            <td>
                                <a href="/resource/demo3/findRoleById?roleid=${role.roleid}">修改</a>
                                <a href="/resource/demo3/deleteRole?roleid=${role.roleid}" >删除</a>
                            </td>
                        </c:if>
                    </tr>
                </c:forEach>
                <c:set var="pages" value="${pageInfo.pages}"/>
                <c:set var="pageNum" value="${pageInfo.pageNum}"/>
                <c:set var="total" value="${pageInfo.total}"/>
                <c:set var="nextPage" value="${pageInfo.nextPage}"/>
                <c:set var="prePage" value="${pageInfo.prePage}"/>

                    <tr>
                        <td colspan="20" style="text-align: center;">
                            <a href="/resource/demo3/findAllRoles?rname=${rname}&deptname=${deptname}&state=${state}" >首页</a>
                            <a href="/resource/demo3/findAllRoles?index=${pageNum== 0 ?1:prePage}&rname=${rname}&deptname=${deptname}&state=${state}" >上一页</a>
                            <c:forEach begin="1" end="${pages}" var="i">
                                <c:if test="${i == pageNum}">
                            <a href="/resource/demo3/findAllRoles?index=${i}&rname=${rname}&deptname=${deptname}&state=${state}" >${i}&nbsp;</a>
                                </c:if>
                                &nbsp;    &nbsp;
                                <c:if test="${i != pageNum}">
                            <a href="/resource/demo3/findAllRoles?index=${i}&rname=${rname}&deptname=${deptname}&state=${state}"  style="text-decoration: none">${i}</a>
                                </c:if>
                            </c:forEach>
                            <a href="/resource/demo3/findAllRoles?index=${pageNum== 0 ?pages:nextPage}&rname=${rname}&deptname=${deptname}&state=${state} " onclick="return ${nextPage!=0} ">下一页</a>
                            <a href="/resource/demo3/findAllRoles?index=${pages}&rname=${rname}&deptname=${deptname}&state=${state}" >尾页</a>
					     共${total}条 每页显示 ${pageNum}/${pages}
                        </td>
                    </tr>
                </tbody>
            </table>
        </form>
        </div>
    </body>
</html>